package StrategyMode.version5;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by ycq on 2018/10/18.
 */
public class Main {

    public static void main(String[] args) {
        Double total=0d; //用于总计
        btnOk_Click(total);

    }

    private static  String  Form1_load(){
        Scanner in =new Scanner(System.in);
        ArrayList arrayList=new ArrayList();
        arrayList.add("正常");
        arrayList.add("返利");
        arrayList.add("打折");
        System.out.println(arrayList);
        System.out.println("请输入以上字符");
        return in.next();
    }
    private  static  void btnOk_Click(Double total){

        CashContext cc=null;
        Scanner in=new Scanner(System.in);
        switch(Form1_load()){
            case "正常":
                cc=new CashContext(new CashNormal());
                break;
            case "返利":
                cc=new CashContext(new CashReturn() );
                break;
            case "打折":
                cc=new CashContext(new CashRebate());
                break;
        }

        Double totalPrices=0.0;
        System.out.println("输入单价");
        Double txtPrice = in.nextDouble();
        System.out.println("输入数量");
        Double txtNum = in.nextDouble();
        totalPrices = cc.GetResult(txtPrice * txtNum);
        total = total + totalPrices;
        System.out.println("单价:" + txtPrice + " 数量:" + txtNum + " 合计:" + totalPrices);
        System.out.println("总计：" + total);



    }
}
